@extends('backend/layouts/default')
@section('title')
<?= !empty($data['news']->id) ? "Thêm tin mới" : "Sửa tin"; ?>
@stop
@section('content')
<h3>
    <span class="glyphicon glyphicon-pencil"></span> <?= !empty($data['news']->id) ? "Thêm tin mới" : "Sửa tin"; ?>
</h3>
<form class="form-horizontal" role="form" method="post" accept-charset="utf-8" action="{{ route('create/news') }}">
    {{ Form::token() }}
    <input type="hidden" value="{{ $data['news']->id }}" name="data[News][id]"/>

    <div class="row">
        <div class="col-md-9">
            <div class="form-group <?= $errors->has('title') ? "error" : "" ?>">
                <label class="control-label col-sm-4">
                    Tiêu đề
                </label>

                <div class="col-sm-8">
                    <input class="form-control" name="data[News][title]" value="<?= $data['news']->title ?>"/>
                    <?= $errors->first('title', '<span class="help-inline">:message</span>') ?>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">
                    Chuyên mục
                </label>

                <div class="col-sm-8">
                    <?= Form::select('data[News][ncategory_id]', $data['categories'], Input::old('data[News][ncategory_id]', $data['news']->ncategory_id), array('class' => 'form-control')); ?>
                </div>
            </div>
            <div class="form-group <?= $errors->has('content') ? "error" : "" ?>">
                <label class="control-label col-sm-4">
                    Nội dung
                </label>

                <div class="col-sm-8">
                    <?= $errors->first('title', '<span class="help-inline">:message</span>') ?>
                    <textarea class="form-control" name="data[News][content]"
                              id="textareabox"><?= $data['news']->content ?></textarea>
                </div>
            </div>
        </div>
        <div class="col-md-3 colright">
            <div>
                <div class="panel panel-default">
                    <div class="panel-heading">Ảnh Thumbnail</div>
                    <div class="panel-body" align="center">
                        <div class="pull-left">
                            <input type="hidden" name="data[News][thumbnail]" value="<?= $data['news']->thumbnail ?>"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
@stop